package servlet.user;
import com.google.gson.Gson;
import dao.PersonalCenterDao;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;

@WebServlet(name = "PersonalCenterServlet", value = "/PersonalCenterServlet.s")
public class PersonalCenterServlet extends HttpServlet {

     PersonalCenterDao dao = new PersonalCenterDao();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("application/json;charset=utf-8");
        response.setCharacterEncoding("utf-8");

        String uid = request.getParameter("uid");


        List<Map<String, Object>> getname = dao.getname(uid);

        System.out.println(getname);

        String json = new Gson().toJson(getname);
        response.getWriter().print(json);

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
